import React from "react";
import styled from "styled-components";
import { Radio } from "antd";
const SwitchStyle = styled(Radio.Group)`
.ant-radio-button-wrapper {
    margin-right: 5px;
    border-radius: 5px;
    border: none;
    font-size: 18px;
    color: #0E497E !important;
    &::before{
        display: none;
      }
    
}
.ant-radio-button-wrapper-checked {
    background:linear-gradient( 90deg, rgba(53, 138, 228),rgba(197, 154, 235) 100%) !important;
   
}
`;
const optInit = [
  {
    label: "图形",
    value: "1",
  },
  {
    label: "表格",
    value: "2",
  },
];
export default function ChartSwitch( {switchType,handleChangeChart = null}) {

  const changeButton = (e) => {
    handleChangeChart && handleChangeChart(e.target?.value)
  };

  return (
    <SwitchStyle
      onChange={ changeButton}
      value={switchType}
      options={optInit}
      defaultValue={switchType}
      buttonStyle="solid"
      optionType="button"
    ></SwitchStyle>
  );
}
